//
//  AppDelegate.m
//  QuickCure1
//
//  Created by maoge on 16/10/30.
//  Copyright © 2016年 maoge. All rights reserved.
//
#import "SickWriteController.h"
#import "AppDelegate.h"
#import "LeftViewController.h"
#import "HomeViewController.h"
#import "ViewController.h"
#import "HomePageDoctorApplyController.h"

//短信验证码
#import <SMS_SDK/SMSSDK.h>
//分享功能
#import <ShareSDK/ShareSDK.h>
#import <ShareSDKConnector/ShareSDKConnector.h>
//新浪微博SDK头文件
#import "WeiboSDK.h"

@interface AppDelegate ()
/** 侧滑的控制器 */
@property (nonatomic, strong) JASidePanelController *viewController;

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    
    //分享至新浪微博需要的平台注册
    [ShareSDK registerApp:@"1896391cf3828"
     
          activePlatforms:@[
                            @(SSDKPlatformTypeSinaWeibo),
                            //                            @(SSDKPlatformTypeWechat)
                            ]
                 onImport:^(SSDKPlatformType platformType)
     {
         switch (platformType)
         {
             case SSDKPlatformTypeSinaWeibo:
                 [ShareSDKConnector connectWeibo:[WeiboSDK class]];
                 break;
             default:
                 break;
         }
     }
          onConfiguration:^(SSDKPlatformType platformType, NSMutableDictionary *appInfo)
     {
         
         switch (platformType)
         {
             case SSDKPlatformTypeSinaWeibo:
                 //设置新浪微博应用信息,其中authType设置为使用SSO＋Web形式授权
                 [appInfo SSDKSetupSinaWeiboByAppKey:@"3267198470"
                                           appSecret:@"d572cf4fdd4341e1d110f7fc523b24c6"
                                         redirectUri:@"http://www.sharesdk.cn"
                                            authType:SSDKAuthTypeBoth];
                 break;
             default:
                 break;
         }
     }];

    
    
    
    _window = [[UIWindow alloc] initWithFrame:SCREEN_BOUNDS];
    
    //设置Window的背景
    UIImage *backImg = [UIImage imageNamed:@"new_background"];
    UIColor *bc = [UIColor colorWithPatternImage:backImg];
    _window.backgroundColor = bc;
    //实例化主控制器
    self.viewController = [[JASidePanelController alloc] init];
    
    //左边控制器
    LeftViewController *leftVC = [[LeftViewController alloc] init];
    
    //左边
    self.viewController.leftPanel = leftVC;
    
    
    //中间
    HomeViewController *homeVc = [[HomeViewController alloc] init];
    self.viewController.centerPanel = [[UINavigationController alloc] initWithRootViewController:homeVc];
    
    
       _window.rootViewController = self.viewController;
    
    //测试用的
//    HomePageDoctorApplyController *vc = [[HomePageDoctorApplyController alloc]init];
//    UINavigationController *navVC = [[UINavigationController alloc]initWithRootViewController:vc];
//    _window.rootViewController = navVC;
//    ViewController *vc = [[ViewController alloc]init];
//    _window.rootViewController = vc;
    [_window makeKeyAndVisible];
    
    //注册短信验证码应用
    [SMSSDK registerApp:@"188df73b0a0cc" withSecret:@"154be720f9b68b8d03fbbd42c0748bf6"];
    
    
    
    
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


@end
